import React, { Component } from 'react'
import { Pagination } from 'antd';
import {connect} from "react-redux"
import * as action from "../action/tableIndex"
import {bindActionCreators} from "redux"
class Pagination1 extends Component {
  componentDidMount(){
      this.props.getList1()
  }
  changeNumber(page, pageSize){ // 当页码发生改变的方法
        console.log(page,pageSize);
        this.props.sendfn(page)
  }
  render() {
    return (

      <div>
          {/* &&运算符都为真才成立，并且返回都为真的最后一个条件 */}
          {
              this.props.arr&&this.props.arr.length&&<Pagination defaultCurrent={1} total={this.props.arr.length} pageSize={8} onChange={this.changeNumber.bind(this)}/>
          }
       
      </div>
    )
  }
}
let mapStateToProps = (state)=>{
    return {
     ...state.tablereducer
    }
}
let mapDsipatchToProps = (dispatch)=>{
    return bindActionCreators(action,dispatch)
}
export default  connect (mapStateToProps,mapDsipatchToProps)(Pagination1)